package cate.game.power;

import cate.game.attr.FightAttr;
import cate.game.attr.PowerAttrPart;
import cate.game.role.Role;

import java.util.HashMap;
import java.util.Map;

public class HoardPowerFactor {
    /**
     * 灵界秘藏属性
     */
    public FightAttr additionAttr;

    private Map<Integer, FightAttr> hoardMap = new HashMap<>();



    public HoardPowerFactor(Role role) {
        if (role == null || !role.getRes().hoard.isOpen()) {
            return;
        }
        additionAttr = role.getRes().hoard.addition.getAttr();
        hoardMap = role.getRes().hoard.addition.getAttrMap();
    }

    public PowerAttrPart buildHeroPart() {
        PowerAttrPart part = new PowerAttrPart();
        for (FightAttr attr : hoardMap.values()) {
            if (attr != null) {
                part.attr.add(attr);
            }
        }
        part.attr.add(additionAttr);
        return part;
    }
}
